From bf8a172fb740231ec6773f756fbcf4d24f9a48a3 Mon Sep 17 00:00:00 2001 From: Phil Hagelberg Date: Sat, 28 Jan 2012 17:49:29 +0800 Subject: [PATCH] Fix M-x package-install failure if no archive has been fetched yet. * emacs-lisp/package.el (package-install): Run package-refresh-contents if there is no archive yet. --- lisp/ChangeLog | 5 +++++ lisp/emacs-lisp/package.el | 2 ++ 2 files changed, 7 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2520c8c5b30..c64ba3a4bfc 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2012-01-28 Phil Hagelberg + + * emacs-lisp/package.el (package-install): Run + package-refresh-contents if there is no archive yet (Bug#97978). + 2012-01-28 Chong Yidong * emacs-lisp/package.el (package-maybe-load-descriptor): New diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 7e56c5534ec..317fa1fd23d 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -889,6 +889,8 @@ archive in `package-archives'. Interactively, prompt for NAME." ;; symbols for completion. (unless package--initialized (package-initialize t)) + (unless package-archive-contents + (package-refresh-contents)) (list (intern (completing-read "Install package: " (mapcar (lambda (elt) -- 2.30.2